<template>
  <a-table :columns="columns"  :data-source="tableList" :pagination="false">
    <span slot="clearingTime" slot-scope="text, record">
      {{ record.clearingTime.replaceAll("T", " ") }}
    </span>
    <span slot="settlementTime" slot-scope="text, record">
      {{ record.settlementTime.replaceAll("T", " ") }}
    </span>
    <span slot="action" slot-scope="text, record">
      <a
        href="javascript:;"
        style="text-decoration: underline; color: rgb(41, 41, 224)"
        @click="storageDetail(record)"
        >仓租明细
      </a>
    </span>
  </a-table>
</template>

<script>
export default {
  props: ["tableList", "tabKey"],
  data() {
    return {};
  },
  methods: {
    //   仓租明细
    storageDetail(record) {
      this.$emit("openStorageDetail", record);
    },
  },
  computed: {
    columns() {
      switch (this.tabKey) {
        case "1":
          return [
            {
              title: "仓库",
              dataIndex: "warehousingName",
              align: "center",
              scopedSlots: { customRender: "warehousingName" },

              //  fixed: "left",
            },
            {
              title: "客户编号",
              dataIndex: "tenantId",
              align: "center",
              scopedSlots: { customRender: "tenantId" },
            },
            {
              title: "时间",
              dataIndex: "clearingTime",
              scopedSlots: { customRender: "clearingTime" },
              align: "center",
            },
            {
              title: "费用",
              dataIndex: "cost",
              scopedSlots: { customRender: "cost" },
              align: "center",

              // ellipsis: true,
            },
            {
              title: "折扣",
              dataIndex: "discount",
              scopedSlots: { customRender: "discount" },
              align: "center",
            },
            {
              title: "实际费用",
              dataIndex: "actualCost",
              scopedSlots: { customRender: "actualCost" },
              align: "center",
            },

            {
              title: "币种",
              dataIndex: "currency",
              scopedSlots: { customRender: "currency" },
              align: "center",
            },
            {
              title: "操作",
              dataIndex: "action",
              scopedSlots: { customRender: "action" },
              align: "center",
            },
          ];
        case "2":
          return [
            {
              title: "仓库",
              dataIndex: "warehouseName",
              align: "center",
              scopedSlots: { customRender: "warehouseName" },
            },
            {
              title: "客户编号",
              dataIndex: "tenantId",
              align: "center",
              scopedSlots: { customRender: "tenantId" },
            },
            {
              title: "时间",
              dataIndex: "settlementTime",
              scopedSlots: { customRender: "settlementTime" },
              align: "center",
            },
            {
              title: "费用",
              dataIndex: "expenses",
              scopedSlots: { customRender: "expenses" },
              align: "center",

              // ellipsis: true,
            },
            {
              title: "折扣",
              dataIndex: "settlementSchemeName",
              scopedSlots: { customRender: "settlementSchemeName" },
              align: "center",
            },
            {
              title: "实际费用",
              dataIndex: "actualPrice",
              scopedSlots: { customRender: "actualPrice" },
              align: "center",
            },

            {
              title: "币种",
              dataIndex: "currency",
              scopedSlots: { customRender: "currency" },
              align: "center",
            },
            {
              title: "操作",
              dataIndex: "action",
              scopedSlots: { customRender: "action" },
              align: "center",
            },
          ];
        case "3":
          return [
            {
              title: "仓库",
              dataIndex: "warehousingName",
              align: "center",
              scopedSlots: { customRender: "warehousingName" },

              //  fixed: "left",
            },
            {
              title: "客户编号",
              dataIndex: "tenantId",
              align: "center",
              scopedSlots: { customRender: "tenantId" },
            },
            {
              title: "时间",
              dataIndex: "clearingTime",
              scopedSlots: { customRender: "clearingTime" },
              align: "center",
            },
            {
              title: "费用",
              dataIndex: "cost",
              scopedSlots: { customRender: "cost" },
              align: "center",

              // ellipsis: true,
            },
            {
              title: "折扣",
              dataIndex: "discount",
              scopedSlots: { customRender: "discount" },
              align: "center",
            },
            {
              title: "实际费用",
              dataIndex: "actualCost",
              scopedSlots: { customRender: "actualCost" },
              align: "center",
            },

            {
              title: "币种",
              dataIndex: "currency",
              scopedSlots: { customRender: "currency" },
              align: "center",
            },
            {
              title: "操作",
              dataIndex: "action",
              scopedSlots: { customRender: "action" },
              align: "center",
            },
          ];
        default:
          return [];
      }
    },
  },
};
</script>

<style lang="less" scoped>
</style>